﻿@{
    ViewBag.Title = "FriendSites";    
}

<div style="width: 100%; float:left; position:relative; top: 60px; margin-left: 60px; margin-bottom: 60px;"> 
    <h2 class="blue-font-title" style="margin-left: 0;">FriendSites</h2>

    <script type="text/javascript">
        var data = @(Html.Raw(Json.Encode(Model)))
    </script>

    <script src="~/Scripts/knockout-2.2.1.js"></script>

    <form data-bind="submit: addFriendSite">
        <table>
            <tr>
                <td>Add Name: </td>
                <td><input id="newNameText" data-bind="value: newNameText" placeholder="RSS Site's Name" /></td>
            </tr>
            <tr>
                <td>Add URL: </td>
                <td><input id="newUrlText" data-bind="value: newUrlText" placeholder="RSS Site's URL" /></td>
            </tr>
            <tr>
                <td>Add Keyword: </td>
                <td><input id="newKeywordText" data-bind="value: newKeywordText" placeholder="Keyword Filter" /></td>
            </tr>
            <tr>
                <td><button class="btn btn-primary" type="submit">Add</button></p></td>
                <td></td>
            </tr>
        </table>

    </form>
    
    <ul data-bind="foreach: friendSites, visible: friendSites().length > 0">
        <li>
            @*<input data-bind="value: id" />*@
            <input data-bind="value: Name, event:{ change: $parent.editFriendSite}" />
            <input data-bind="value: Url, event:{ change: $parent.editFriendSite}" />
            <input data-bind="value: Keyword, event:{ change: $parent.editFriendSite}" />
            @*<input data-bind="value: SiteId" />*@
            <a class="btn btn-primary" style="color: #fff;font-size: 14px;font-family: Sans-Serif;font-weight: bold;" href="#" data-bind="click: $parent.removeFriendSite">Delete</a>
        </li> 
    </ul>
</div>

@section scripts {
    <script src="~/Scripts/jquery.signalR-1.1.2.js"></script>
    <script src="~/signalr/hubs"></script>
    <script src="~/Areas/Admin/ViewModel/FriendSitesVM.js"></script>
}